<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>密码修改</title>
    <script type="text/javascript" src="__PUBLIC__/Public/js/jquery.min.1.11.3.js"></script>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        #edit_pw{
            margin: 50px 50px;
            width: 700px;
            height: 300px;
        }
        h2{
            line-height: 50px;
        }
        table{
            margin: 0px;
            width: 500px;
            line-height: 50px;
        }
        td:first-child{
            width: 100px;
            text-align: right;
        }
        input{
            width: 200px;
            height: 30px;
            border: solid 1px #66afe9;
        }
        #sub{
            width: 200px;
            margin:15px 70px;
        }
        #sub input{
            width: 100px;
        }
    </style>
</head>
<body>
<div id="edit_pw">
    <div><h2>密码修改</h2>
        <form action="/personage/edit_pw" onsubmit="return check();" method="post">
            <input type="hidden" name="uid" value="<!--{$Think.session.users.id}-->"/>

            <table>
                <tr>
                    <td>原密码：</td>
                    <td><input type="password" name="ori_pw" id="ori_pw" required="" oninvalid="setCustomValidity('请输入原密码');" oninput="setCustomValidity('');"/> <span id="tips"></span></td>
                </tr>
                <tr>
                    <td>新密码：</td>
                    <td><input type="password" name="password" id="password" required="" oninvalid="setCustomValidity('请输入新密码');" oninput="setCustomValidity('');"/></td>
                </tr>
                <tr>
                    <td>确认新密码：</td>
                    <td><input type="password" name="password1" id="password1" required="" oninvalid="setCustomValidity('请输入新密码');" oninput="setCustomValidity('');"/></td>
                </tr>
            </table>
            <div id="sub"><input type="submit" name="submit" class="btn" value="确认"/></div>
        </form>
    </div>
</div>

<script type="text/javascript">
    function check(){
        if($("#password").val()!=$("#password1").val()){
            alert("新密码不一致");
            return false;
        }
    }

    $("#ori_pw").blur(function(){
        $.getJSON("/personage/ajax_pw",{ori_pw:$(this).val(),id:<!--{$Think.session.users.id}-->},function(msg){
            if(msg){
                $("#tips").text("正确").css("color","#0a0");
            }else{
                $("#ori_pw").focus;
                $("#tips").text("错误，请重新输入").css("color","#f00");
            }
        })
    })

</script>

</body>
</html>